package com.zhangshanfeng.test;

import java.time.format.DateTimeFormatter;

//厨师生产者
public class Cooker extends Thread{


    @Override
    public void run() {

        while(true){
            synchronized (Desk.lock){
                if(Desk.count == 0){//数量为0
                    break;
                }else {

                    if(!Desk.flage){//桌子上没有
                        System.out.println("厨师制作佛跳墙");
                        Desk.flage = true;

                        Desk.lock.notifyAll();//唤醒线程
                    }else {
                        try {
                            Desk.lock.wait();
                        } catch (InterruptedException e) {
                            e.printStackTrace();
                        }
                    }
                }

            }

        }



    }
}
